home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
003
/
books.arc
/
UPDATE.PRG
< prev
Wrap
Text File
|
1985-04-17
|
3KB
|
110 lines
* update.prg
* Update the Chart of Accounts (COA)
* file from transactions (TRANS).
erase
? 'This program should be performed to bring the '
? 'Chart of Accounts balances up-to-date'
?
store ' ' to yn
@ 5,2 say "Is this the program you want ? " get yn
read
* return to main menu if requested
if !(yn) <> 'Y'
retu
endif
* Get date of last update from geninfo
use geninfo
stor last:updat to last:date
* Ask about how to perform update, and
* double check for safety.
store f to ok
do while .not. ok
erase
store ' ' to new:qtr,new:month,new:year
@ 5,2 say "Chart of accounts was last updated "
@ 5,36 say "on "+last:date
@ 8,2 say "Is this the start of a new month ? "
@ 8,40 get new:month pict "!"
read
if new:month = "Y"
@ 10,2 say "Is this the start of a new quarter? "
@ 10,38 get new:qtr pict "!"
@ 12,2 say "Is this the start of a new year? "
@ 12,38 get new:year pict "!"
read
endi
@ 14,20 say "Ok? (Y/N) " get ok pict "!"
read
endd ( while not ok)
* copy all non-posted records from
* the trans file to a temp file,
* then flag all records as posted.
erase
? "Performing the update...."
use trans index acct
copy to temp for .not. posted
repl all posted with t noupdate
* Set month to date field (amount)
* to 0 if starting new month
use coa index coa
if new:month = "Y"
repl all amount with 0
endif (new:month = y)
* If start of new quarter, replace all
* quarterly balances with 0 too.
If new:qtr = "Y"
repl all qtd with 0 noupdate
endif (new :qtr = Y)
* If start of new year, replace all
* yearly balances with 0 too.
If new:year = "Y"
repl all ytd with 0 noupdate
endif (new:year = "Y")
* set up data files for update
sele prim
use coa index coa
sele seco
use temp
* do update
do while .not. eof
stor str(acct,6,2) to lookup
sele prim
find &lookup
repl p.amount with p.amount + s.amount
repl qtd with qtd + s.amount
repl ytd with ytd + s.amount
sele seco
skip
enddo (while not end of seco file)
* when done with update, close the
* data files.
sele seco
use
sele prim
use
* update geninfo
* with new date of last update.
use geninfo
repl last:updat with t:date
use
rele last:date,new:month,new:qtr,new:year
rele lookup,yn,ok
return
uarter? "
@ 10,38 get new:qtr pict "!"
@ 12,2 say "Is this the start of a new year? "
@ 12,38 get new:year pict "!"
read
endi
@ 14,20 say "Ok? (Y/N) " get ok pict